﻿<Page x:Class="SlaktDataReader.Pages.pgMoveOut"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:SlaktDataReader"
      mc:Ignorable="d" 
      DataContext="{Binding RelativeSource={RelativeSource self}}"
      d:DesignHeight="600" d:DesignWidth="900"	Title="pgMoveOut">
    <Page.Resources>
        <local:titleFirstSurName x:Key="tfsConv" />

        <DataTemplate x:Key="mName">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=Title}" />
                <TextBlock Name="a" FontWeight="Bold">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource tfsConv}">
                            <Binding Path="Title" />
                            <Binding Path="FirstName" />
                            <Binding Path="SurName" />
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </StackPanel>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Gender}" Value="M">
                    <Setter TargetName="a" Property="Foreground" Value="Blue" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Gender}" Value="K">
                    <Setter TargetName="a" Property="Foreground" Value="Red" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>


    </Page.Resources>
    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="55" />
            <RowDefinition Height="330*" />
            <RowDefinition Height="215" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Background="{DynamicResource DarkColor1}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.ColumnSpan="2">

                <Border Width="60" BorderBrush="{DynamicResource BookColor6}" Background="{DynamicResource BookColor6}" BorderThickness="1">
                    <TextBlock Text="U" Foreground="White" FontSize="48" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Garamond" />
                </Border>
                <TextBlock Style="{StaticResource BirthBookHeader}" ><Run FontWeight="Bold">UTFLYTTNINGS</Run>BOK</TextBlock>
                <TextBlock Style="{StaticResource BirthBookTitle}" Text="{Binding Path=MoveOutBook.FriendlyName}" Margin="10,10,0,0" />
                <TextBlock Style="{StaticResource BirthBookTitle}" Text="{Binding Path=MoveOutBook.Period}" Margin="10,10,0,0" />
            </StackPanel>
            <StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
                <Button Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,20,0" Width="75" Height="25" Content="Filter" Click="bFilter_Click"/>
                <Button x:Name="bback" Content="X" Width="40" Height="25" Margin="10,0,10,0" Click="bback_Click"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="1">
            <ListView Name="lvMoveOut" Margin="0,0,0,20" BorderBrush="Transparent" BorderThickness="0" ItemsSource="{Binding Path=MoveOutBookData.Items}" >
                <ListView.View>
                    <GridView >
                        <GridViewColumn Header="LotNo" DisplayMemberBinding="{Binding Path=RowID}" />
                        <GridViewColumn Header="Sida"  DisplayMemberBinding="{Binding Path=PageNo}"/>
                        <GridViewColumn Header="Kön" DisplayMemberBinding="{Binding Path=Gender}" />
                        <GridViewColumn Header="Datum" DisplayMemberBinding="{Binding Path=MoveOutDate}"/>
                        <GridViewColumn Header="Attestnr" DisplayMemberBinding="{Binding Path=AttestNo}" />
                        <GridViewColumn Header="Namn" CellTemplate="{StaticResource mName}" />
                        <GridViewColumn Header="Från Adress" DisplayMemberBinding="{Binding Path=FRAddress}" />
                        <GridViewColumn Header="Till Adress" DisplayMemberBinding="{Binding Path=ToAdress}" />

                        <GridViewColumn Header="Född" DisplayMemberBinding="{Binding Path=BornDate}" />
                        <GridViewColumn Header="Extra 1" DisplayMemberBinding="{Binding Path=Extra1}"/>
                        <GridViewColumn Header="Extra 2" DisplayMemberBinding="{Binding Path=Extra2}"/>
                    </GridView>
                </ListView.View>
            </ListView>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                <TextBlock Name="textBlock1" Text="Antal poster: " />
                <TextBlock Margin="8,0,10,0" Text="{Binding ElementName=lvMoveOut, Path=Items.Count}" FontWeight="Bold" Foreground="{DynamicResource BookColor2}"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="2" Background="{DynamicResource BG1}">
            <ScrollViewer Name="svList" HorizontalScrollBarVisibility="Disabled">
                <WrapPanel Name="wp" >
                    
                </WrapPanel>
            </ScrollViewer>
        </Grid>
        <Border Grid.RowSpan="3" Width="680" Height="250" Background="White" BorderBrush="{DynamicResource BookColor1}" BorderThickness="2" CornerRadius="4" Name="FilterWindow" Visibility="Collapsed">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150" />
                    <ColumnDefinition Width="238*" />
                    <ColumnDefinition Width="288*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="60" />
                    <RowDefinition Height="45" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Grid Grid.Column="0" Grid.ColumnSpan="3" Background="#E0F0E0">
                    <Border Width="65" BorderBrush="{DynamicResource BookColor3}" Background="{DynamicResource BookColor4}" BorderThickness="1" HorizontalAlignment="Left">
                        <TextBlock Text="U" Foreground="White" FontSize="48" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Garamond" />
                    </Border>

                    <TextBlock HorizontalAlignment="Left" Margin="164,0,0,6" Name="textBlock2" Text="FILTRERA RESULTAT" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="28" />


                </Grid>
                <TextBlock Grid.Row="1" HorizontalAlignment="Left" Margin="14,0,0,5" Text="Förnamn" VerticalAlignment="Bottom" Grid.Column="1" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="16" />
                <TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" Margin="20,0,0,5" Text="Efternamn" VerticalAlignment="Bottom" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="16" />
                <TextBlock Grid.Row="2" HorizontalAlignment="Right" Margin="0,0,10,0" Text="Person:" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="18" FontWeight="Normal" Foreground="{StaticResource DarkColor2}" />
                <TextBlock Grid.Row="3" HorizontalAlignment="Right" Margin="0,0,10,0" Text="Ort:" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="18" FontWeight="Normal" Foreground="{StaticResource DarkColor2}"/>
                <TextBox Grid.Row="2" HorizontalAlignment="Left" Margin="14,0,0,0" Name="cfirst" VerticalAlignment="Center" Width="216" Grid.Column="1" Style="{StaticResource stdTextBox}" />
                <TextBox Grid.Row="2" Grid.Column="2" HorizontalAlignment="Left" Margin="20,0,0,0" Name="csur" VerticalAlignment="Center" Width="216" Style="{StaticResource stdTextBox}" />
                <TextBox Grid.Row="3" HorizontalAlignment="Left" Margin="14,0,0,0" Name="mort" VerticalAlignment="Center" Width="216" Grid.Column="1" Style="{StaticResource stdTextBox}" />
                <Button Content="SÖK" Grid.Column="2" Grid.Row="4" Height="25" HorizontalAlignment="Left" Margin="136,17,0,0" Name="bApplyFilter" Click="bApplyFilter_Click" VerticalAlignment="Top" Width="100" Style="{StaticResource SearchButton}" />

            </Grid>
        </Border>

    </Grid>
</Page>
